package com.yutel.amote;

import com.yutel.amote.service.AmoteConstant;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

public class AmoteActivity extends Activity {
	private static final String TAG = "Amote";

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		AmoteConstant con = AmoteConstant.getInstance(AmoteActivity.this);
		String appType = con.getKey("appType");
		String port=con.getKey("serverPort");
		String client = this.getResources().getString(R.string.clienttype);
		Log.d(TAG, "appType : " + appType + ",client=" + client);
		if (appType == null) {
			Intent intent = new Intent(AmoteActivity.this,
					ApptypeActivity.class);
			startActivity(intent);
		} else {
			if (client.equals(appType)) {
				if(port==null && "".equals(port)) {
					Intent intent = new Intent(AmoteActivity.this,
							ClientCfgActivity.class);
					startActivity(intent);
				} else {
					Intent intent = new Intent(AmoteActivity.this,
							TouchActivity.class);
					startActivity(intent);
				}
			} else {
				Intent intent = new Intent(AmoteActivity.this,
						ServerCfgActivity.class);
				startActivity(intent);
			}
		}
		finish();
	}
}